package com.jz.netthings.application.providerAllot.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.jz.netthings.application.providerAllot.bean.ProviderAllot;
import com.jz.netthings.application.providerAllot.bean.QueryProviderAllot;
import com.jz.netthings.application.providerAllot.service.ProviderAllotService;
import com.jz.netthings.application.providerReg.bean.ProviderReg;
import com.jz.netthings.application.providerReg.bean.QueryProviderReg;
import com.jz.netthings.application.providerReg.service.ProviderRegService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.security.utils.Token;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-13
 */
@RestController
@RequestMapping("/adscm/application/providerAllot")
public class ProviderAllotController {
    @Autowired
    RedisTemplate<Object, Token> tokenRedisTemplate;
    @Autowired
    ProviderAllotService providerAllotService;

    @RequestMapping("/select")
    public SimpleCoreResponse selectByTime(@RequestBody QueryProviderAllot queryProviderAllot, HttpServletRequest request) throws AdscmSystemException, IOException {
        Page<ProviderAllot> page =new Page<>(queryProviderAllot.getCurrentPage(),queryProviderAllot.getPageSize());
        Page<ProviderAllot>  providerAllots = providerAllotService.selectProviderAllot(page ,queryProviderAllot);
        return new SimpleCoreResponse("200","查询成功" ,providerAllots);
    }
}

